//
//  MiddlewaresConfig.swift
//  App
//
//  Created by 汤泽川 on 2019/3/25.
//

import Foundation
import Vapor

public func MiddlewaresConfigure(_ config: inout Config, _ env: inout Environment, _ services: inout Services) throws {
    var middlewares = MiddlewareConfig() // Create _empty_ middleware config
    middlewares.use(FileMiddleware.self) // Serves files from `Public/` directory
    middlewares.use(APIErrorMiddleware()) // Catches errors and converts to HTTP response
    services.register(middlewares)
}
